// This is an automatically generated code sample.
// To make this code sample work in your Oracle Cloud tenancy,
// please replace the values for any parameters whose current values do not fit
// your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
// boolean, number, and enum parameters with values not fitting your use case).

import * as dataintegration from "oci-dataintegration";
import common = require("oci-common");

// Create a default authentication provider that uses the DEFAULT
// profile in the configuration file.
// Refer to <see href="https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File>the public documentation</see> on how to prepare a configuration file.

const provider: common.ConfigFileAuthenticationDetailsProvider = new common.ConfigFileAuthenticationDetailsProvider();

(async () => {
  try {
    // Create a service client
    const client = new dataintegration.DataIntegrationClient({
      authenticationDetailsProvider: provider
    });

    // Create a request and dependent object(s).
    const createPipelineDetails = {
      key: "EXAMPLE-key-Value",
      modelVersion: "EXAMPLE-modelVersion-Value",
      parentRef: {
        parent: "EXAMPLE-parent-Value",
        rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
      },
      name: "EXAMPLE-name-Value",
      description: "EXAMPLE-description-Value",
      modelType: "EXAMPLE-modelType-Value",
      objectVersion: 939,
      objectStatus: 601,
      identifier: "EXAMPLE-identifier-Value",
      nodes: [
        {
          key: "EXAMPLE-key-Value",
          modelType: "EXAMPLE-modelType-Value",
          modelVersion: "EXAMPLE-modelVersion-Value",
          parentRef: {
            parent: "EXAMPLE-parent-Value",
            rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
          },
          name: "EXAMPLE-name-Value",
          description: "EXAMPLE-description-Value",
          inputLinks: [
            {
              modelType: "INPUT_LINK",
              fromLink: "EXAMPLE-fromLink-Value",
              fieldMap: {
                modelType: "RULE_BASED_FIELD_MAP",
                key: "EXAMPLE-key-Value",
                modelVersion: "EXAMPLE-modelVersion-Value",
                parentRef: {
                  parent: "EXAMPLE-parent-Value",
                  rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
                },
                configValues: {
                  configParamValues: {
                    EXAMPLE_KEY_TVuIF: {
                      stringValue: "EXAMPLE-stringValue-Value",
                      intValue: 95,
                      objectValue: "EXAMPLE-objectValue-Value",
                      refValue: "EXAMPLE-refValue-Value",
                      parameterValue: "EXAMPLE-parameterValue-Value",
                      rootObjectValue: "EXAMPLE-rootObjectValue-Value"
                    }
                  },
                  parentRef: {
                    parent: "EXAMPLE-parent-Value",
                    rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
                  }
                },
                mapType: dataintegration.models.RuleBasedFieldMap.MapType.Mapbyname,
                fromPattern: "EXAMPLE-fromPattern-Value",
                toPattern: "EXAMPLE-toPattern-Value",
                isJavaRegexSyntax: false,
                objectStatus: 956,
                fromRuleConfig: {
                  modelType: "RULE_TYPE_CONFIGS",
                  key: "EXAMPLE-key-Value",
                  modelVersion: "EXAMPLE-modelVersion-Value",
                  parentRef: {
                    parent: "EXAMPLE-parent-Value",
                    rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
                  },
                  scope: "EXAMPLE-scope-Value",
                  scopeReference: {
                    referenceObject: "EXAMPLE-referenceObject-Value",
                    referenceType:
                      dataintegration.models.ScopeReference.ReferenceType.OciFunctionOutputShape,
                    refObjectName: "EXAMPLE-refObjectName-Value"
                  },
                  isOrderByRule: false,
                  projectionRules: [
                    {
                      modelType: "RENAME_RULE",
                      isSkipRemainingRulesOnMatch: false,
                      fromName: "EXAMPLE-fromName-Value",
                      toName: "EXAMPLE-toName-Value",
                      key: "EXAMPLE-key-Value",
                      modelVersion: "EXAMPLE-modelVersion-Value",
                      parentRef: {
                        parent: "EXAMPLE-parent-Value",
                        rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
                      },
                      isJavaRegexSyntax: true,
                      configValues: {
                        configParamValues: {
                          EXAMPLE_KEY_k5140: {
                            stringValue: "EXAMPLE-stringValue-Value",
                            intValue: 306,
                            objectValue: "EXAMPLE-objectValue-Value",
                            refValue: "EXAMPLE-refValue-Value",
                            parameterValue: "EXAMPLE-parameterValue-Value",
                            rootObjectValue: "EXAMPLE-rootObjectValue-Value"
                          }
                        },
                        parentRef: {
                          parent: "EXAMPLE-parent-Value",
                          rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
                        }
                      },
                      objectStatus: 509,
                      description: "EXAMPLE-description-Value"
                    }
                  ],
                  configValues: {
                    configParamValues: {
                      EXAMPLE_KEY_ddyzU: {
                        stringValue: "EXAMPLE-stringValue-Value",
                        intValue: 503,
                        objectValue: "EXAMPLE-objectValue-Value",
                        refValue: "EXAMPLE-refValue-Value",
                        parameterValue: "EXAMPLE-parameterValue-Value",
                        rootObjectValue: "EXAMPLE-rootObjectValue-Value"
                      }
                    },
                    parentRef: {
                      parent: "EXAMPLE-parent-Value",
                      rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
                    }
                  },
                  objectStatus: 596
                },
                toRuleConfig: {
                  modelType: "RULE_TYPE_CONFIGS",
                  key: "EXAMPLE-key-Value",
                  modelVersion: "EXAMPLE-modelVersion-Value",
                  parentRef: {
                    parent: "EXAMPLE-parent-Value",
                    rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
                  },
                  scope: "EXAMPLE-scope-Value",
                  scopeReference: {
                    referenceObject: "EXAMPLE-referenceObject-Value",
                    referenceType:
                      dataintegration.models.ScopeReference.ReferenceType.BoundEntityShape,
                    refObjectName: "EXAMPLE-refObjectName-Value"
                  },
                  isOrderByRule: false,
                  projectionRules: [
                    {
                      modelType: "RENAME_RULE",
                      isSkipRemainingRulesOnMatch: true,
                      fromName: "EXAMPLE-fromName-Value",
                      toName: "EXAMPLE-toName-Value",
                      key: "EXAMPLE-key-Value",
                      modelVersion: "EXAMPLE-modelVersion-Value",
                      parentRef: {
                        parent: "EXAMPLE-parent-Value",
                        rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
                      },
                      isJavaRegexSyntax: false,
                      configValues: {
                        configParamValues: {
                          EXAMPLE_KEY_WXiq7: {
                            stringValue: "EXAMPLE-stringValue-Value",
                            intValue: 544,
                            objectValue: "EXAMPLE-objectValue-Value",
                            refValue: "EXAMPLE-refValue-Value",
                            parameterValue: "EXAMPLE-parameterValue-Value",
                            rootObjectValue: "EXAMPLE-rootObjectValue-Value"
                          }
                        },
                        parentRef: {
                          parent: "EXAMPLE-parent-Value",
                          rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
                        }
                      },
                      objectStatus: 549,
                      description: "EXAMPLE-description-Value"
                    }
                  ],
                  configValues: {
                    configParamValues: {
                      EXAMPLE_KEY_wqRbc: {
                        stringValue: "EXAMPLE-stringValue-Value",
                        intValue: 77,
                        objectValue: "EXAMPLE-objectValue-Value",
                        refValue: "EXAMPLE-refValue-Value",
                        parameterValue: "EXAMPLE-parameterValue-Value",
                        rootObjectValue: "EXAMPLE-rootObjectValue-Value"
                      }
                    },
                    parentRef: {
                      parent: "EXAMPLE-parent-Value",
                      rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
                    }
                  },
                  objectStatus: 600
                },
                description: "EXAMPLE-description-Value"
              },
              key: "EXAMPLE-key-Value",
              modelVersion: "EXAMPLE-modelVersion-Value",
              parentRef: {
                parent: "EXAMPLE-parent-Value",
                rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
              },
              objectStatus: 92,
              description: "EXAMPLE-description-Value",
              port: "EXAMPLE-port-Value"
            }
          ],
          outputLinks: [
            {
              modelType: "OUTPUT_LINK",
              toLinks: ["EXAMPLE--Value"],
              key: "EXAMPLE-key-Value",
              modelVersion: "EXAMPLE-modelVersion-Value",
              parentRef: {
                parent: "EXAMPLE-parent-Value",
                rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
              },
              objectStatus: 80,
              description: "EXAMPLE-description-Value",
              port: "EXAMPLE-port-Value"
            }
          ],
          operator: {
            modelType: "MERGE_OPERATOR",
            triggerRule: dataintegration.models.MergeOperator.TriggerRule.AllSuccess,
            key: "EXAMPLE-key-Value",
            modelVersion: "EXAMPLE-modelVersion-Value",
            parentRef: {
              parent: "EXAMPLE-parent-Value",
              rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
            },
            name: "EXAMPLE-name-Value",
            description: "EXAMPLE-description-Value",
            objectVersion: 329,
            inputPorts: [
              {
                modelType: "INPUT_PORT",
                portType: dataintegration.models.InputPort.PortType.Data,
                fields: [
                  {
                    modelType: "TYPED_EXPRESSION",
                    expression: "EXAMPLE-expression-Value",
                    type: "EXAMPLE-type-Value",
                    key: "EXAMPLE-key-Value",
                    modelVersion: "EXAMPLE-modelVersion-Value",
                    parentRef: {
                      parent: "EXAMPLE-parent-Value",
                      rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
                    },
                    configValues: {
                      configParamValues: {
                        EXAMPLE_KEY_kphX9: {
                          stringValue: "EXAMPLE-stringValue-Value",
                          intValue: 681,
                          objectValue: "EXAMPLE-objectValue-Value",
                          refValue: "EXAMPLE-refValue-Value",
                          parameterValue: "EXAMPLE-parameterValue-Value",
                          rootObjectValue: "EXAMPLE-rootObjectValue-Value"
                        }
                      },
                      parentRef: {
                        parent: "EXAMPLE-parent-Value",
                        rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
                      }
                    },
                    objectStatus: 961,
                    name: "EXAMPLE-name-Value",
                    description: "EXAMPLE-description-Value"
                  }
                ],
                key: "EXAMPLE-key-Value",
                modelVersion: "EXAMPLE-modelVersion-Value",
                parentRef: {
                  parent: "EXAMPLE-parent-Value",
                  rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
                },
                configValues: {
                  configParamValues: {
                    EXAMPLE_KEY_th7By: {
                      stringValue: "EXAMPLE-stringValue-Value",
                      intValue: 635,
                      objectValue: "EXAMPLE-objectValue-Value",
                      refValue: "EXAMPLE-refValue-Value",
                      parameterValue: "EXAMPLE-parameterValue-Value",
                      rootObjectValue: "EXAMPLE-rootObjectValue-Value"
                    }
                  },
                  parentRef: {
                    parent: "EXAMPLE-parent-Value",
                    rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
                  }
                },
                objectStatus: 649,
                name: "EXAMPLE-name-Value",
                description: "EXAMPLE-description-Value"
              }
            ],
            outputPorts: [
              {
                modelType: "FIELD",
                key: "EXAMPLE-key-Value",
                modelVersion: "EXAMPLE-modelVersion-Value",
                parentRef: {
                  parent: "EXAMPLE-parent-Value",
                  rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
                },
                configValues: {
                  configParamValues: {
                    EXAMPLE_KEY_67231: {
                      stringValue: "EXAMPLE-stringValue-Value",
                      intValue: 760,
                      objectValue: "EXAMPLE-objectValue-Value",
                      refValue: "EXAMPLE-refValue-Value",
                      parameterValue: "EXAMPLE-parameterValue-Value",
                      rootObjectValue: "EXAMPLE-rootObjectValue-Value"
                    }
                  },
                  parentRef: {
                    parent: "EXAMPLE-parent-Value",
                    rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
                  }
                },
                objectStatus: 908,
                name: "EXAMPLE-name-Value",
                description: "EXAMPLE-description-Value"
              }
            ],
            objectStatus: 965,
            identifier: "EXAMPLE-identifier-Value",
            parameters: [
              {
                modelType: "PARAMETER",
                type: "EXAMPLE-type-Value",
                defaultValue: "EXAMPLE-defaultValue-Value",
                rootObjectDefaultValue: "EXAMPLE-rootObjectDefaultValue-Value",
                isInput: false,
                isOutput: false,
                outputAggregationType: dataintegration.models.Parameter.OutputAggregationType.Count,
                typeName: "EXAMPLE-typeName-Value",
                usedFor: "EXAMPLE-usedFor-Value",
                key: "EXAMPLE-key-Value",
                modelVersion: "EXAMPLE-modelVersion-Value",
                parentRef: {
                  parent: "EXAMPLE-parent-Value",
                  rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
                },
                configValues: {
                  configParamValues: {
                    EXAMPLE_KEY_cyvCo: {
                      stringValue: "EXAMPLE-stringValue-Value",
                      intValue: 241,
                      objectValue: "EXAMPLE-objectValue-Value",
                      refValue: "EXAMPLE-refValue-Value",
                      parameterValue: "EXAMPLE-parameterValue-Value",
                      rootObjectValue: "EXAMPLE-rootObjectValue-Value"
                    }
                  },
                  parentRef: {
                    parent: "EXAMPLE-parent-Value",
                    rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
                  }
                },
                objectStatus: 615,
                name: "EXAMPLE-name-Value",
                description: "EXAMPLE-description-Value"
              }
            ],
            opConfigValues: {
              configParamValues: {
                EXAMPLE_KEY_Mboku: {
                  stringValue: "EXAMPLE-stringValue-Value",
                  intValue: 426,
                  objectValue: "EXAMPLE-objectValue-Value",
                  refValue: "EXAMPLE-refValue-Value",
                  parameterValue: "EXAMPLE-parameterValue-Value",
                  rootObjectValue: "EXAMPLE-rootObjectValue-Value"
                }
              },
              parentRef: {
                parent: "EXAMPLE-parent-Value",
                rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
              }
            }
          },
          uiProperties: {
            coordinateX: 9248.399,
            coordinateY: 1890.6522
          },
          objectStatus: 902
        }
      ],
      parameters: [
        {
          modelType: "PARAMETER",
          type: "EXAMPLE-type-Value",
          defaultValue: "EXAMPLE-defaultValue-Value",
          rootObjectDefaultValue: "EXAMPLE-rootObjectDefaultValue-Value",
          isInput: true,
          isOutput: false,
          outputAggregationType: dataintegration.models.Parameter.OutputAggregationType.Max,
          typeName: "EXAMPLE-typeName-Value",
          usedFor: "EXAMPLE-usedFor-Value",
          key: "EXAMPLE-key-Value",
          modelVersion: "EXAMPLE-modelVersion-Value",
          parentRef: {
            parent: "EXAMPLE-parent-Value",
            rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
          },
          configValues: {
            configParamValues: {
              EXAMPLE_KEY_dfCPd: {
                stringValue: "EXAMPLE-stringValue-Value",
                intValue: 92,
                objectValue: "EXAMPLE-objectValue-Value",
                refValue: "EXAMPLE-refValue-Value",
                parameterValue: "EXAMPLE-parameterValue-Value",
                rootObjectValue: "EXAMPLE-rootObjectValue-Value"
              }
            },
            parentRef: {
              parent: "EXAMPLE-parent-Value",
              rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
            }
          },
          objectStatus: 433,
          name: "EXAMPLE-name-Value",
          description: "EXAMPLE-description-Value"
        }
      ],
      flowConfigValues: {
        configParamValues: {
          EXAMPLE_KEY_iV1JA: {
            stringValue: "EXAMPLE-stringValue-Value",
            intValue: 907,
            objectValue: "EXAMPLE-objectValue-Value",
            refValue: "EXAMPLE-refValue-Value",
            parameterValue: "EXAMPLE-parameterValue-Value",
            rootObjectValue: "EXAMPLE-rootObjectValue-Value"
          }
        },
        parentRef: {
          parent: "EXAMPLE-parent-Value",
          rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
        }
      },
      variables: [
        {
          key: "EXAMPLE-key-Value",
          modelVersion: "EXAMPLE-modelVersion-Value",
          modelType: "EXAMPLE-modelType-Value",
          parentRef: {
            parent: "EXAMPLE-parent-Value",
            rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
          },
          name: "EXAMPLE-name-Value",
          description: "EXAMPLE-description-Value",
          objectVersion: 191,
          objectStatus: 86,
          identifier: "EXAMPLE-identifier-Value",
          type: {
            modelType: "JAVA_TYPE",
            javaTypeName: "EXAMPLE-javaTypeName-Value",
            configDefinition: {
              key: "EXAMPLE-key-Value",
              modelType: "EXAMPLE-modelType-Value",
              modelVersion: "EXAMPLE-modelVersion-Value",
              parentRef: {
                parent: "EXAMPLE-parent-Value",
                rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
              },
              name: "EXAMPLE-name-Value",
              isContained: true,
              objectStatus: 438,
              configParameterDefinitions: {
                EXAMPLE_KEY_sQnMP: {
                  parameterName: "EXAMPLE-parameterName-Value",
                  description: "EXAMPLE-description-Value",
                  defaultValue: "EXAMPLE-defaultValue-Value",
                  classFieldName: "EXAMPLE-classFieldName-Value",
                  isStatic: false,
                  isClassFieldValue: true
                }
              }
            },
            key: "EXAMPLE-key-Value",
            modelVersion: "EXAMPLE-modelVersion-Value",
            parentRef: {
              parent: "EXAMPLE-parent-Value",
              rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
            },
            name: "EXAMPLE-name-Value",
            objectStatus: 40,
            description: "EXAMPLE-description-Value"
          },
          configValues: {
            configParamValues: {
              EXAMPLE_KEY_2TtUy: {
                stringValue: "EXAMPLE-stringValue-Value",
                intValue: 571,
                objectValue: "EXAMPLE-objectValue-Value",
                refValue: "EXAMPLE-refValue-Value",
                parameterValue: "EXAMPLE-parameterValue-Value",
                rootObjectValue: "EXAMPLE-rootObjectValue-Value"
              }
            },
            parentRef: {
              parent: "EXAMPLE-parent-Value",
              rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
            }
          },
          defaultValue: "EXAMPLE-defaultValue-Value",
          rootObjectDefaultValue: {
            key: "EXAMPLE-key-Value",
            modelType: "EXAMPLE-modelType-Value",
            modelVersion: "EXAMPLE-modelVersion-Value",
            parentRef: {
              parent: "EXAMPLE-parent-Value",
              rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
            },
            objectStatus: 931
          }
        }
      ],
      registryMetadata: {
        aggregatorKey: "EXAMPLE-aggregatorKey-Value",
        labels: ["EXAMPLE--Value"],
        registryVersion: 293,
        key: "EXAMPLE-key-Value",
        isFavorite: false
      }
    };

    const createPipelineRequest: dataintegration.requests.CreatePipelineRequest = {
      workspaceId: "ocid1.test.oc1..<unique_ID>EXAMPLE-workspaceId-Value",
      createPipelineDetails: createPipelineDetails,
      opcRetryToken: "EXAMPLE-opcRetryToken-Value",
      opcRequestId: "QTBLMWXGWACEVLYDWDOS<unique_ID>"
    };

    // Send request to the Client.
    const createPipelineResponse = await client.createPipeline(createPipelineRequest);
  } catch (error) {
    console.log("createPipeline Failed with error  " + error);
  }
})();